package org.tong.ctr.resource;

import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author
 * @date 2022-09-03 18:20
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @GetMapping("/")
    public String index() {
        return "this is user index " + new Date();
    }

    @GetMapping("/getUser")
    public Object getUser(Authentication authentication) {
        return authentication.getPrincipal();
    }
}
